package com.dao;
import com.pojo.User;
import org.apache.ibatis.annotations.*;
import java.util.List;
import java.util.Map;

public interface UserDao {

    @Select("select count(id) from user where id=#{username} or eMail=#{username} and password=#{password};")
    int getCount(Map<String,String> map);

    @Select("select*from user where id=#{username} or eMail=#{username};")
    User getBYIdOrEMail(String username);

    @Select("select likeBook from user")
    List<String> getLikeBooks();

    @Insert("insert into user(id,eMail) values(null,#{eMail});")
    void quickAdd(String eMail);

    @Update("update user set password=#{password} where id=#{id};")
    void updatePassword(Map<String,String> map);

    @Update("update user set nickName=#{nickName},likeBook=#{likeBook} where id=#{id};")
    void update(User user);

    @Delete("delete from user where id=#{id}")
    void delete(int id);

}
